
$(function () {

    var curRole = sessionStorage.getItem('curRole');
    var leftLoad = '';
    if(curRole == 'TEACHER'){
        leftLoad = 'teacher_left.html';
    }else if(curRole == 'RESEARCH'){
        leftLoad = 'research_left.html';
    }else if(curRole == 'OFFICE'){
        leftLoad = 'office_left.html';
    }else{
        leftLoad = 'department_left.html';
    }
    $("#top").load('top.html');
    $("#left").load(leftLoad,function () {
        menuActive(2,1);
    });

    queryPost({pageNum:1});
    //获取岗位列表
    function queryPost(param) {
        param.pageSize = 10;
        param.collegeId = '';
        param.userId = sessionStorage.getItem('userId')
        requests.postReq(urls.teachPostList,JSON.stringify(param),initPostList,null);
    }
    //渲染列表
    function initPostList(data) {
        if(data.status == 1){
            data = data.data;
            var items = data.list;
            var postListHtml = '';
            $.each(items,function (i,val) {
                postListHtml += '<tr>' +
                    '<td>'+compTime(val.lastUpdateTime)+'</td>'+
                    '<td>'+val.collegeName+'</td>'+
                    '<td>'+val.postLevel+'</td>'+
                    '<td>'+val.postCount+'</td>'+
                    '<td>'+val.publisher+'</td>'+
                    '</tr>';
            })
            $("#post_list").html(postListHtml);
        }
    }

})